Ext.create('Ext.data.Store', {
    storeId: 'wa_store1',
    fields: ['adCd', 'totWat', 'totRs'],
    data: []
});

Ext.create('Ext.data.Store', {
    storeId: 'wa_store2',
    fields: ["regCd", "a1", "b1", "a2", "b2", "a3", "b3", "a4", "b4", "a5", "b5",
        "a6", "b6", "a7", "b7", "a8", "b8", "a9", "b9", "a10", "b10", "a11", "b11", "a12", "b12"
    ],
    data: []
});

Ext.create('Ext.data.Store', {
    storeId: 'wa_store3',
    fields: ["type", "atotal", "a1", "b1", "a2", "b2", "a3", "b3", "a4", "b4", "a5", "b5",
        "a6", "b6", "a7", "b7", "a8", "b8", "a9", "b9", "a10", "b10", "a11", "b11", "a12", "b12"
    ],
    data: []
});


Ext.define('Admin.view.needWater.waterAllocation.WaterAllocation', {
    extend: 'Ext.panel.Panel',
    xtype: 'waterAllocation',
    requires: ['Admin.view.needWater.waterAllocation.WaterAllocationController'],
    controller: 'waterAllocationController',
    // margin: 15,
    layout: {
        type: 'hbox',
        align: 'stretch'
    },
    items: [{
        width: 250,
        xtype: 'panel',
        layout: {
            type: 'vbox',
            align: 'stretch'
        },
        items: [{
            height: 270,
            title: '水量分配',
            border: true,
            items: [{
                margin: '37 0 0 20',
                padding: '10 10 0 10',
                reference: 'waText',
                html: '<div style="font-weight: bold;font-size: 18px;">' +
                '<p style="color: #00CC33;padding-bottom: 10px;">可供水量：<span id="waMaxSl"></span> 亿m³</p>' +
                '<p style="color: #FF0000;">申报水量：<span id="waTotRs"></span> 亿m³</p>' +
                '</div>'
            }, {
                margin: '30 0 0 0',
                tbar: ['->', {
                    style: 'background-color: #16a3f4;',
                    text: '<span style="font-size: 14px;color: #fff;">一键分配</span>',
                    handler: 'allocationCalc'
                }, '->']
            }]
        }, {
            title: '行政区分配结果（万m³）',
            flex: 1,
            border: true,
            margin: '10 0 0 0',
            xtype: 'grid',
            autoScroll: true,
            loadMask: true,
            stripeRows: true,
            columnLines: true,
            reference: 'grid0',
            // forceFit: true,
            columns: [{
                text: '行政区',
                dataIndex: 'adCd',
                editor: 'textfield',
                align: 'center',
                flex: 1,
                renderer: 'formatAdCdToName'
            }, {
                text: '需水',
                dataIndex: 'total1',
                editor: 'numberfield',
                align: 'right',
                flex: 1
            }, {
                text: '分配',
                dataIndex: 'total2',
                editor: 'numberfield',
                align: 'right',
                flex: 1
            }],
            listeners: {
                rowclick: 'changeArea'
            },
            store: Ext.data.StoreManager.lookup('wa_store1')
        }]
    }, {
        flex: 1,
        xtype: 'panel',
        margin: '0 5 0 10',
        layout: {
            type: 'vbox',
            align: 'stretch'
        },
        items: [{
            height: 270,
            title: '用水单元（万m³）',
            border: true,
            xtype: 'grid',
            loadMask: true,
            autoScroll: true,
            stripeRows: true,
            columnLines: true,
            // forceFit: true,
            columns: [{
                text: '用水单元',
                dataIndex: 'regCd',
                editor: 'textfield',
                align: 'center',
                // locked: true,
                width: 150,
                style: 'background: #EEEEEE',
                renderer: 'formatRegCdToName'
            }, {
                text: '1月',
                align: 'right',
                style: 'background: #EEEEEE',
                columns: [{
                    text: '申报',
                    dataIndex: 'a1',
                    editor: 'numberfield',
                    align: 'right',
                    style: 'background: #EEEEEE',
                    width: 80
                }, {
                    text: '分配',
                    dataIndex: 'b1',
                    editor: 'numberfield',
                    align: 'right',
                    style: 'background: #EEEEEE',
                    width: 80
                }]
            }, {
                text: '2月',
                align: 'right',
                style: 'background: #EEEEEE',
                columns: [{
                    text: '申报',
                    dataIndex: 'a2',
                    editor: 'textfield',
                    align: 'right',
                    style: 'background: #EEEEEE',
                    width: 80
                }, {
                    text: '分配',
                    dataIndex: 'b2',
                    editor: 'textfield',
                    align: 'right',
                    style: 'background: #EEEEEE',
                    width: 80
                }]
            }, {
                text: '3月',
                align: 'right',
                style: 'background: #EEEEEE',
                columns: [{
                    text: '申报',
                    dataIndex: 'a3',
                    editor: 'textfield',
                    align: 'right',
                    style: 'background: #EEEEEE',
                    width: 80
                }, {
                    text: '分配',
                    dataIndex: 'b3',
                    editor: 'textfield',
                    align: 'right',
                    style: 'background: #EEEEEE',
                    width: 80
                }]
            }, {
                text: '4月',
                align: 'right',
                style: 'background: #EEEEEE',
                columns: [{
                    text: '申报',
                    dataIndex: 'a4',
                    editor: 'textfield',
                    align: 'right',
                    style: 'background: #EEEEEE',
                    width: 80
                }, {
                    text: '分配',
                    dataIndex: 'b4',
                    editor: 'textfield',
                    align: 'right',
                    style: 'background: #EEEEEE',
                    width: 80
                }]
            }, {
                text: '5月',
                align: 'right',
                style: 'background: #EEEEEE',
                columns: [{
                    text: '申报',
                    dataIndex: 'a5',
                    editor: 'textfield',
                    align: 'right',
                    style: 'background: #EEEEEE',
                    width: 80
                }, {
                    text: '分配',
                    dataIndex: 'b5',
                    editor: 'textfield',
                    align: 'right',
                    style: 'background: #EEEEEE',
                    width: 80
                }]
            }, {
                text: '6月',
                align: 'right',
                style: 'background: #EEEEEE',
                columns: [{
                    text: '申报',
                    dataIndex: 'a6',
                    editor: 'textfield',
                    align: 'right',
                    style: 'background: #EEEEEE',
                    width: 80
                }, {
                    text: '分配',
                    dataIndex: 'b6',
                    editor: 'textfield',
                    align: 'right',
                    style: 'background: #EEEEEE',
                    width: 80
                }]
            }, {
                text: '7月',
                align: 'right',
                style: 'background: #EEEEEE',
                columns: [{
                    text: '申报',
                    dataIndex: 'a7',
                    editor: 'textfield',
                    align: 'right',
                    style: 'background: #EEEEEE',
                    width: 80
                }, {
                    text: '分配',
                    dataIndex: 'b7',
                    editor: 'textfield',
                    align: 'right',
                    style: 'background: #EEEEEE',
                    width: 80
                }]
            }, {
                text: '8月',
                align: 'right',
                style: 'background: #EEEEEE',
                columns: [{
                    text: '申报',
                    dataIndex: 'a8',
                    editor: 'textfield',
                    align: 'right',
                    style: 'background: #EEEEEE',
                    width: 80
                }, {
                    text: '分配',
                    dataIndex: 'b8',
                    editor: 'textfield',
                    align: 'right',
                    style: 'background: #EEEEEE',
                    width: 80
                }]
            }, {
                text: '9月',
                align: 'right',
                style: 'background: #EEEEEE',
                columns: [{
                    text: '申报',
                    dataIndex: 'a9',
                    editor: 'textfield',
                    align: 'right',
                    style: 'background: #EEEEEE',
                    width: 80
                }, {
                    text: '分配',
                    dataIndex: 'b9',
                    editor: 'textfield',
                    align: 'right',
                    style: 'background: #EEEEEE',
                    width: 80
                }]
            }, {
                text: '10月',
                align: 'right',
                style: 'background: #EEEEEE',
                columns: [{
                    text: '申报',
                    dataIndex: 'a10',
                    editor: 'textfield',
                    align: 'right',
                    style: 'background: #EEEEEE',
                    width: 80
                }, {
                    text: '分配',
                    dataIndex: 'b10',
                    editor: 'textfield',
                    align: 'right',
                    style: 'background: #EEEEEE',
                    width: 80
                }]
            }, {
                text: '11月',
                align: 'right',
                style: 'background: #EEEEEE',
                columns: [{
                    text: '申报',
                    dataIndex: 'a11',
                    editor: 'textfield',
                    align: 'right',
                    style: 'background: #EEEEEE',
                    width: 80
                }, {
                    text: '分配',
                    dataIndex: 'b11',
                    editor: 'textfield',
                    align: 'right',
                    style: 'background: #EEEEEE',
                    width: 80
                }]
            }, {
                text: '12月',
                align: 'right',
                style: 'background: #EEEEEE',
                columns: [{
                    text: '申报',
                    dataIndex: 'a12',
                    editor: 'textfield',
                    align: 'right',
                    style: 'background: #EEEEEE',
                    width: 80
                }, {
                    text: '分配',
                    dataIndex: 'b12',
                    editor: 'textfield',
                    align: 'right',
                    style: 'background: #EEEEEE',
                    width: 80
                }]
            }],
            store: Ext.data.StoreManager.lookup('wa_store2')
        }, {
            flex: 1,
            title: '用水类型（万m³）',
            border: true,
            margin: '10 0 0 0',
            xtype: 'grid',
            autoScroll: true,
            loadMask: true,
            stripeRows: true,
            columnLines: true,
            // forceFit: true,
            columns: [{
                text: '用水类型',
                dataIndex: 'type',
                editor: 'textfield',
                align: 'center',
                style: 'background: #EEEEEE',
                width: 120
            }, {
                text: '总需水',
                dataIndex: 'atotal',
                editor: 'textfield',
                align: 'center',
                style: 'background: #EEEEEE',
                width: 100
            }, {
                text: '1月',
                align: 'right',
                style: 'background: #EEEEEE',
                columns: [{
                    text: '申报',
                    dataIndex: 'a1',
                    editor: 'numberfield',
                    align: 'right',
                    style: 'background: #EEEEEE',
                    width: 80
                }, {
                    text: '分配',
                    dataIndex: 'b1',
                    editor: 'numberfield',
                    align: 'right',
                    style: 'background: #EEEEEE',
                    width: 80
                }, {
                    text: '折减比例(%)',
                    dataIndex: 'c1',
                    editor: 'textfield',
                    align: 'right',
                    style: 'background: #EEEEEE',
                    width: 110,
                    renderer: 'renderReduction'
                }]
            }, {
                text: '2月',
                align: 'right',
                style: 'background: #EEEEEE',
                columns: [{
                    text: '申报',
                    dataIndex: 'a2',
                    editor: 'numberfield',
                    align: 'right',
                    style: 'background: #EEEEEE',
                    width: 80
                }, {
                    text: '分配',
                    dataIndex: 'b2',
                    editor: 'numberfield',
                    align: 'right',
                    style: 'background: #EEEEEE',
                    width: 80
                }, {
                    text: '折减比例(%)',
                    dataIndex: 'c2',
                    editor: 'textfield',
                    align: 'right',
                    style: 'background: #EEEEEE',
                    width: 110,
                    renderer: 'renderReduction'
                }]
            }, {
                text: '3月',
                align: 'right',
                style: 'background: #EEEEEE',
                columns: [{
                    text: '申报',
                    dataIndex: 'a3',
                    editor: 'numberfield',
                    align: 'right',
                    style: 'background: #EEEEEE',
                    width: 80
                }, {
                    text: '分配',
                    dataIndex: 'b3',
                    editor: 'numberfield',
                    align: 'right',
                    style: 'background: #EEEEEE',
                    width: 80
                }, {
                    text: '折减比例(%)',
                    dataIndex: 'c3',
                    editor: 'textfield',
                    align: 'right',
                    style: 'background: #EEEEEE',
                    width: 110,
                    renderer: 'renderReduction'
                }]
            }, {
                text: '4月',
                align: 'right',
                style: 'background: #EEEEEE',
                columns: [{
                    text: '申报',
                    dataIndex: 'a4',
                    editor: 'numberfield',
                    align: 'right',
                    style: 'background: #EEEEEE',
                    width: 80
                }, {
                    text: '分配',
                    dataIndex: 'b4',
                    editor: 'numberfield',
                    align: 'right',
                    style: 'background: #EEEEEE',
                    width: 80
                }, {
                    text: '折减比例(%)',
                    dataIndex: 'c4',
                    editor: 'textfield',
                    align: 'right',
                    style: 'background: #EEEEEE',
                    width: 110,
                    renderer: 'renderReduction'
                }]
            }, {
                text: '5月',
                align: 'right',
                style: 'background: #EEEEEE',
                columns: [{
                    text: '申报',
                    dataIndex: 'a5',
                    editor: 'numberfield',
                    align: 'right',
                    style: 'background: #EEEEEE',
                    width: 80
                }, {
                    text: '分配',
                    dataIndex: 'b5',
                    editor: 'numberfield',
                    align: 'right',
                    style: 'background: #EEEEEE',
                    width: 80
                }, {
                    text: '折减比例(%)',
                    dataIndex: 'c5',
                    editor: 'textfield',
                    align: 'right',
                    style: 'background: #EEEEEE',
                    width: 110,
                    renderer: 'renderReduction'
                }]
            }, {
                text: '6月',
                align: 'right',
                style: 'background: #EEEEEE',
                columns: [{
                    text: '申报',
                    dataIndex: 'a6',
                    editor: 'numberfield',
                    align: 'right',
                    style: 'background: #EEEEEE',
                    width: 80
                }, {
                    text: '分配',
                    dataIndex: 'b6',
                    editor: 'numberfield',
                    align: 'right',
                    style: 'background: #EEEEEE',
                    width: 80
                }, {
                    text: '折减比例(%)',
                    dataIndex: 'c6',
                    editor: 'textfield',
                    align: 'right',
                    style: 'background: #EEEEEE',
                    width: 110,
                    renderer: 'renderReduction'
                }]
            }, {
                text: '7月',
                align: 'right',
                style: 'background: #EEEEEE',
                columns: [{
                    text: '申报',
                    dataIndex: 'a7',
                    editor: 'numberfield',
                    align: 'right',
                    style: 'background: #EEEEEE',
                    width: 80
                }, {
                    text: '分配',
                    dataIndex: 'b7',
                    editor: 'numberfield',
                    align: 'right',
                    style: 'background: #EEEEEE',
                    width: 80
                }, {
                    text: '折减比例(%)',
                    dataIndex: 'c7',
                    editor: 'textfield',
                    align: 'right',
                    style: 'background: #EEEEEE',
                    width: 110,
                    renderer: 'renderReduction'
                }]
            }, {
                text: '8月',
                align: 'right',
                style: 'background: #EEEEEE',
                columns: [{
                    text: '申报',
                    dataIndex: 'a8',
                    editor: 'numberfield',
                    align: 'right',
                    style: 'background: #EEEEEE',
                    width: 80
                }, {
                    text: '分配',
                    dataIndex: 'b8',
                    editor: 'numberfield',
                    align: 'right',
                    style: 'background: #EEEEEE',
                    width: 80
                }, {
                    text: '折减比例(%)',
                    dataIndex: 'c8',
                    editor: 'textfield',
                    align: 'right',
                    style: 'background: #EEEEEE',
                    width: 110,
                    renderer: 'renderReduction'
                }]
            }, {
                text: '9月',
                align: 'right',
                style: 'background: #EEEEEE',
                columns: [{
                    text: '申报',
                    dataIndex: 'a9',
                    editor: 'numberfield',
                    align: 'right',
                    style: 'background: #EEEEEE',
                    width: 80
                }, {
                    text: '分配',
                    dataIndex: 'b9',
                    editor: 'numberfield',
                    align: 'right',
                    style: 'background: #EEEEEE',
                    width: 80
                }, {
                    text: '折减比例(%)',
                    dataIndex: 'c9',
                    editor: 'textfield',
                    align: 'right',
                    style: 'background: #EEEEEE',
                    width: 110,
                    renderer: 'renderReduction'
                }]
            }, {
                text: '10月',
                align: 'right',
                style: 'background: #EEEEEE',
                columns: [{
                    text: '申报',
                    dataIndex: 'a10',
                    editor: 'numberfield',
                    align: 'right',
                    style: 'background: #EEEEEE',
                    width: 80
                }, {
                    text: '分配',
                    dataIndex: 'b10',
                    editor: 'numberfield',
                    align: 'right',
                    style: 'background: #EEEEEE',
                    width: 80
                }, {
                    text: '折减比例(%)',
                    dataIndex: 'c10',
                    editor: 'textfield',
                    align: 'right',
                    style: 'background: #EEEEEE',
                    width: 110,
                    renderer: 'renderReduction'
                }]
            }, {
                text: '11月',
                align: 'right',
                style: 'background: #EEEEEE',
                columns: [{
                    text: '申报',
                    dataIndex: 'a11',
                    editor: 'numberfield',
                    align: 'right',
                    style: 'background: #EEEEEE',
                    width: 80
                }, {
                    text: '分配',
                    dataIndex: 'b11',
                    editor: 'numberfield',
                    align: 'right',
                    style: 'background: #EEEEEE',
                    width: 80
                }, {
                    text: '折减比例(%)',
                    dataIndex: 'c11',
                    editor: 'textfield',
                    align: 'right',
                    style: 'background: #EEEEEE',
                    width: 110,
                    renderer: 'renderReduction'
                }]
            }, {
                text: '12月',
                align: 'right',
                style: 'background: #EEEEEE',
                columns: [{
                    text: '申报',
                    dataIndex: 'a12',
                    editor: 'numberfield',
                    align: 'right',
                    style: 'background: #EEEEEE',
                    width: 80
                }, {
                    text: '分配',
                    dataIndex: 'b12',
                    editor: 'numberfield',
                    align: 'right',
                    style: 'background: #EEEEEE',
                    width: 80
                }, {
                    text: '折减比例(%)',
                    dataIndex: 'c12',
                    editor: 'textfield',
                    align: 'right',
                    style: 'background: #EEEEEE',
                    width: 110,
                    renderer: 'renderReduction'
                }]
            }],
            store: Ext.data.StoreManager.lookup('wa_store3')
        }]
    }],
    listeners: {
        show: 'showPage'
    }
});